﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            text2();
        }
        public static void text1()
        {
            int[] arr = new int[10];
            ArrayList rom = new ArrayList();
            for (int i = 1; i <= 10; i++) rom.Add(i);
            Random rd = new Random();
            for (int i = 0; i < arr.Length ; i++)
            {
                int rindex = rd.Next(0, rom.Count);
                arr[i] = Convert.ToInt32(rom[rindex]);
                rom.RemoveAt(rindex);
            }
            //foreach (int a int arr)
            //        {
            //    Console.WriteLine(a);            
            //        }
            
        }
        public static void text2()
        {
        //生成0 - 5之间的随机小数，保留两位小数
              Random rd = new Random();
            double a = Math.Round(rd.NextDouble() * (5 - 0) +0, 2);
            Console.WriteLine(a);
            Console.ReadKey();
        }
        public static void text3()
        {
            // 生成4 - 7之间的随机小数，保留两位小数。
            Random ra = new Random();
            double b = Math.Round(ra.NextDouble() * (7 - 4) + 4, 2);
            Console.WriteLine(b);
            Console.ReadKey();
        }
    }
}
